//
//  HZJNavigationBar.swift
//  HZJNavigationView
//
//  Created by HZJ on 2017/2/20.
//  Copyright © 2017年 HZJ. All rights reserved.
//

import UIKit

class HZJNavigationBar: UINavigationBar {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.addSubview(myLeftBtn)
        self.addSubview(myRightBtn)

        myLeftBtn.frame = CGRect(x: 15, y: (frame.height - 40) * 0.5, width: 40, height: 40)
        
        myRightBtn.frame = CGRect(x: frame.width - 40 - 15, y:(frame.height - 40) * 0.5, width: 40, height: 40)
        myRightBtn.setTitle("right", for: UIControl.State.normal)

    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    /**
     *导航栏左侧按钮，若需添加点击方法，应重写“clickTheLeftBtn”方法
     */
    lazy var myLeftBtn:UIButton = {
        let btn = UIButton()
        btn.setTitleColor(UIColor.black, for: UIControl.State.normal)
        btn.showsTouchWhenHighlighted = true
        btn.titleLabel?.textAlignment = .center
        return btn
    }()
    
    /**
     *导航栏右侧按钮，若需添加点击方法，应重写“clickTheRightBtn”方法
     */
    lazy var myRightBtn:UIButton = {
        let btn = UIButton()
        btn.setTitleColor(UIColor.black, for: UIControl.State.normal)
        btn.showsTouchWhenHighlighted = true
        btn.titleLabel?.textAlignment = .center
        return btn
    }()

}
